﻿using System;
using System.Diagnostics;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

namespace Assets.Scripts.UI.Controller
{
	// Token: 0x0200037B RID: 891
	public class BreastPhysicsController : MonoBehaviour
	{
		// Token: 0x1700038E RID: 910
		// (get) Token: 0x060016FC RID: 5884 RVA: 0x00093E7D File Offset: 0x0009207D
		// (set) Token: 0x060016FD RID: 5885 RVA: 0x00093E85 File Offset: 0x00092085
		public float Elasticity { get; set; }

		// Token: 0x1700038F RID: 911
		// (get) Token: 0x060016FE RID: 5886 RVA: 0x00093E8E File Offset: 0x0009208E
		// (set) Token: 0x060016FF RID: 5887 RVA: 0x00093E96 File Offset: 0x00092096
		public float Stiffness { get; set; }

		// Token: 0x17000390 RID: 912
		// (get) Token: 0x06001700 RID: 5888 RVA: 0x00093E9F File Offset: 0x0009209F
		// (set) Token: 0x06001701 RID: 5889 RVA: 0x00093EA7 File Offset: 0x000920A7
		public float Inert { get; set; }

		// Token: 0x17000391 RID: 913
		// (get) Token: 0x06001702 RID: 5890 RVA: 0x00093EB0 File Offset: 0x000920B0
		// (set) Token: 0x06001703 RID: 5891 RVA: 0x00093EB8 File Offset: 0x000920B8
		public float Dampening { get; set; }

		// Token: 0x17000392 RID: 914
		// (get) Token: 0x06001704 RID: 5892 RVA: 0x00093EC1 File Offset: 0x000920C1
		// (set) Token: 0x06001705 RID: 5893 RVA: 0x00093EC9 File Offset: 0x000920C9
		public bool Collider { get; set; }

		// Token: 0x14000006 RID: 6
		// (add) Token: 0x06001706 RID: 5894 RVA: 0x00093ED4 File Offset: 0x000920D4
		// (remove) Token: 0x06001707 RID: 5895 RVA: 0x00093F0C File Offset: 0x0009210C
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private event Action OnAccept;

		// Token: 0x14000007 RID: 7
		// (add) Token: 0x06001708 RID: 5896 RVA: 0x00093F44 File Offset: 0x00092144
		// (remove) Token: 0x06001709 RID: 5897 RVA: 0x00093F7C File Offset: 0x0009217C
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private event Action OnCancel;

		// Token: 0x14000008 RID: 8
		// (add) Token: 0x0600170A RID: 5898 RVA: 0x00093FB4 File Offset: 0x000921B4
		// (remove) Token: 0x0600170B RID: 5899 RVA: 0x00093FEC File Offset: 0x000921EC
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private event Action OnEnable;

		// Token: 0x14000009 RID: 9
		// (add) Token: 0x0600170C RID: 5900 RVA: 0x00094024 File Offset: 0x00092224
		// (remove) Token: 0x0600170D RID: 5901 RVA: 0x0009405C File Offset: 0x0009225C
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private event Action OnDisable;

		// Token: 0x0600170E RID: 5902 RVA: 0x00094094 File Offset: 0x00092294
		private void Awake()
		{
			Button[] componentsInChildren = base.transform.GetComponentsInChildren<Button>();
			componentsInChildren[0].onClick.AddListener(new UnityAction(this.Enable));
			componentsInChildren[1].onClick.AddListener(new UnityAction(this.Disable));
			componentsInChildren[2].onClick.AddListener(new UnityAction(this.Accept));
			componentsInChildren[3].onClick.AddListener(new UnityAction(this.Cancel));
			Slider[] componentsInChildren2 = base.transform.GetComponentsInChildren<Slider>();
			foreach (Slider slider in componentsInChildren2)
			{
				slider.minValue = 0f;
				slider.maxValue = 1000f;
			}
			this.dampeningSlider = componentsInChildren2[0];
			this.elasticitySlider = componentsInChildren2[1];
			this.stiffnessSlider = componentsInChildren2[2];
			this.inertSlider = componentsInChildren2[3];
			Toggle[] componentsInChildren3 = base.transform.GetComponentsInChildren<Toggle>();
			this.colliderToggle = componentsInChildren3[0];
			this.dampeningSlider.onValueChanged.AddListener(new UnityAction<float>(this.DampeningChanged));
			this.elasticitySlider.onValueChanged.AddListener(new UnityAction<float>(this.ElasticityChanged));
			this.stiffnessSlider.onValueChanged.AddListener(new UnityAction<float>(this.StiffnessChanged));
			this.inertSlider.onValueChanged.AddListener(new UnityAction<float>(this.InertChanged));
			this.colliderToggle.onValueChanged.AddListener(new UnityAction<bool>(this.ColliderChanged));
		}

		// Token: 0x0600170F RID: 5903 RVA: 0x0009421C File Offset: 0x0009241C
		private void Deconstruct()
		{
			UnityEngine.Object.Destroy(base.gameObject);
			this.dampeningSlider.onValueChanged.RemoveAllListeners();
			this.elasticitySlider.onValueChanged.RemoveAllListeners();
			this.stiffnessSlider.onValueChanged.RemoveAllListeners();
			this.inertSlider.onValueChanged.RemoveAllListeners();
			this.colliderToggle.onValueChanged.RemoveAllListeners();
			Button[] componentsInChildren = base.transform.GetComponentsInChildren<Button>();
			foreach (Button button in componentsInChildren)
			{
				button.onClick.RemoveAllListeners();
			}
		}

		// Token: 0x06001710 RID: 5904 RVA: 0x000942B5 File Offset: 0x000924B5
		private void ColliderChanged(bool arg0)
		{
			this.Collider = this.colliderToggle.isOn;
		}

		// Token: 0x06001711 RID: 5905 RVA: 0x000942C8 File Offset: 0x000924C8
		private void InertChanged(float arg0)
		{
			this.Inert = this.inertSlider.value / 1000f;
		}

		// Token: 0x06001712 RID: 5906 RVA: 0x000942E1 File Offset: 0x000924E1
		private void StiffnessChanged(float arg0)
		{
			this.Stiffness = this.stiffnessSlider.value / 1000f;
		}

		// Token: 0x06001713 RID: 5907 RVA: 0x000942FA File Offset: 0x000924FA
		private void ElasticityChanged(float arg0)
		{
			this.Elasticity = this.elasticitySlider.value / 1000f;
		}

		// Token: 0x06001714 RID: 5908 RVA: 0x00094313 File Offset: 0x00092513
		private void DampeningChanged(float arg0)
		{
			this.Dampening = this.dampeningSlider.value / 1000f;
		}

		// Token: 0x06001715 RID: 5909 RVA: 0x0009432C File Offset: 0x0009252C
		private void Enable()
		{
			this.OnEnable();
		}

		// Token: 0x06001716 RID: 5910 RVA: 0x00094339 File Offset: 0x00092539
		private void Disable()
		{
			this.OnDisable();
		}

		// Token: 0x06001717 RID: 5911 RVA: 0x00094346 File Offset: 0x00092546
		private void Cancel()
		{
			this.Deconstruct();
			this.OnCancel();
		}

		// Token: 0x06001718 RID: 5912 RVA: 0x00094359 File Offset: 0x00092559
		private void Accept()
		{
			this.OnAccept();
			this.Deconstruct();
		}

		// Token: 0x06001719 RID: 5913 RVA: 0x0009436C File Offset: 0x0009256C
		public void ReloadUi()
		{
			this.stiffnessSlider.value = this.Stiffness * 1000f;
			this.elasticitySlider.value = this.Elasticity * 1000f;
			this.inertSlider.value = this.Inert * 1000f;
			this.dampeningSlider.value = this.Dampening * 1000f;
			this.colliderToggle.isOn = this.Collider;
		}

		// Token: 0x0600171A RID: 5914 RVA: 0x000943E6 File Offset: 0x000925E6
		public void AttachActions(Action onAccept, Action onCancel, Action onEnable, Action onDisable)
		{
			this.OnAccept = onAccept;
			this.OnCancel = onCancel;
			this.OnEnable = onEnable;
			this.OnDisable = onDisable;
		}

		// Token: 0x0400199C RID: 6556
		private const float cModifier = 1000f;

		// Token: 0x0400199D RID: 6557
		private Slider elasticitySlider;

		// Token: 0x0400199E RID: 6558
		private Slider stiffnessSlider;

		// Token: 0x0400199F RID: 6559
		private Slider inertSlider;

		// Token: 0x040019A0 RID: 6560
		private Slider dampeningSlider;

		// Token: 0x040019A6 RID: 6566
		private Toggle colliderToggle;
	}
}
